import { AbnormalStatus } from '@/pages/AbnormalAppeal/types.d';
import styles from '../style.less';
import { ABO_TYPE_MAP, getAbnormalStatusPic } from '../../abnormal-order';
import moment from 'moment';
const CurrDataView = (props: { currData: AbnormalOrderTableItem }) => {
  const { currData } = props;
  const wait_revise = currData.status == AbnormalStatus.WAITING;
  return (
    <div style={{ textAlign: 'left', marginTop: 10, position: 'relative', fontSize: 16 }}>
      <div style={{ position: 'absolute', right: 0, top: 0 }}>
        <img src={getAbnormalStatusPic(currData.status || 1)} width={95} height={80} />
      </div>
      <table cellSpacing={0} cellPadding={0} className={styles.mytable}>
        <tbody>
          <tr>
            <td className={styles.tdTitle}>异常类型</td>
            <td>
              <strong style={{ color: wait_revise ? 'red' : 'black' }}>
                {ABO_TYPE_MAP.get(currData.type) || '未知异常'}
              </strong>
            </td>
          </tr>
          {currData.status == AbnormalStatus.CLOSED && (
            <tr>
              <td className={styles.tdTitle}>泊位编号</td>
              <td>{currData.spotId || '-'}</td>
            </tr>
          )}
          <tr>
            <td className={styles.tdTitle}>巡检车牌</td>
            <td>{currData.plateNumber || '-'}</td>
          </tr>

          <tr>
            <td className={styles.tdTitle}>订单编号</td>
            <td>{currData.orderNo}</td>
          </tr>

          <tr>
            <td className={styles.tdTitle}>巡检时间</td>
            <td>
              {currData.createTime
                ? moment(currData.createTime).format('YYYY-MM-DD HH:mm:ss')
                : '-'}
            </td>
          </tr>

          <tr>
            <td className={styles.tdTitle}>异常描述</td>
            <td>{currData.desc}</td>
          </tr>

          {!wait_revise && (
            <>
              <tr>
                <td className={styles.tdTitle}>审核时间</td>
                <td>{moment(currData.handledTime).format('YYYY-MM-DD HH:mm:ss')}</td>
              </tr>
              <tr>
                <td className={styles.tdTitle}>审核人员</td>
                <td>{currData.operUserName || '-'}</td>
              </tr>
              <tr>
                <td className={styles.tdTitle}>审核结果</td>
                <td>{currData.result}</td>
              </tr>
              <tr>
                <td className={styles.tdTitle}>操作备注</td>
                <td>{currData.remark || '-'}</td>
              </tr>
            </>
          )}
        </tbody>
      </table>
    </div>
  );
};

export default CurrDataView;
